<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.mashen.voteSystem.entity.Vote" %>
<%@page import="com.mashen.voteSystem.service.VoteService" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>join_vote</title>
<link rel="stylesheet" href="css/bootstrap.css" />
<script src="js/jquery-3.1.0.min.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body>
<div style="margin-bottom: 20px;padding-top:6px;padding-left:8px;height:30px;background-color: #f2f2f2;">
    <span style="color: #2f6da7">投票管理</span> / 参与投票
</div>
<div class="col-md-12 column">
    <table class="table">
        <thead>
        <tr>
            <th>
                编号
            </th>
            <th>
                主题
            </th>
            <th>
                发起时间
            </th>
            <th>
                状态
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>
        <tbody>
        <%
        	//获取所有投票
        	VoteService voteService = new VoteService();
        	List<Vote> list = voteService.getAllVote();
        	String status;
        %>
        <%
        	if(list != null){
        		for(Iterator<Vote> iter = list.iterator();iter.hasNext();){
        			Vote vote = iter.next();
        			if(vote.getStatus() == 1){
        				status = "进行中";
        			}else{
        				status = "终止";
        			}
        %>
        <tr>
        	<td><%=vote.getVote_id() %></td>
        	<td><%=vote.getSubject() %></td>
        	<td><%=vote.getStart_time()%></td>
        	<td><%=status %></td>
        	<td>
        		<button class="btn btn-sm" style="background-color: #5DB95D;color:white">投票结果</button>
                <button class="btn btn-sm" style="background-color: #D9534F;color:white">终止投票</button>
        	</td>
        </tr>
        <%
        		}
        	}
        %>
        </tbody>
    </table>
</div>
</body>
</html>